clear

*This do file prepares EVRR for merge with Leblang's macro-level data
*Last updated: May 16, 2022

*Insert your root folder location below
cd  "FOLDER YOUR LOCATION HERE

use "EVRR_Dataset.dta"

sort stateid year

*Cutnote: remove folder root in final version
save "evrr_merge.dta", replace


use "ExtraDatasets\macro_data.dta"

gen obs_num = [_n-1] + 1

*To facilitate the merge, we need to add stateid to the macrodata. 
*It's best to use "ifs", as this is the only country-specific id consistent in Leblang's dataset. 

gen str3 stateid="xxx"				
replace stateid = "MLI" if ifs==678
replace stateid = "SAU" if ifs==456
replace stateid = "" if ifs==314
replace stateid = "" if ifs==938
replace stateid = "WSM" if ifs==862
replace stateid = "SEN" if ifs==722
replace stateid = "GUA" if ifs==258
replace stateid = "MEX" if ifs==273
replace stateid = "" if ifs==479
replace stateid = "STP" if ifs==716
replace stateid = "VEN" if ifs==299
replace stateid = "TAJ" if ifs==923
replace stateid = "CZE" if ifs==934
replace stateid = "BOS" if ifs==963
replace stateid = "CZR" if ifs==935
replace stateid = "NIG" if ifs==694
replace stateid = "MAD" if ifs==556
replace stateid = "SWA" if ifs==734
replace stateid = "OMA" if ifs==449
replace stateid = "KUW" if ifs==443
replace stateid = "MAG" if ifs==674
replace stateid = "BLR" if ifs==913
replace stateid = "NIR" if ifs==692
replace stateid = "" if ifs==537
replace stateid = "EST" if ifs==939
replace stateid = "PAR" if ifs==288
replace stateid = "" if ifs==859
replace stateid = "BEN" if ifs==638
replace stateid = "ROK" if ifs==542
replace stateid = "RWA" if ifs==714
replace stateid = "" if ifs==346
replace stateid = "TON" if ifs==866
replace stateid = "SLO" if ifs==936
replace stateid = "" if ifs==696
replace stateid = "KZK" if ifs==916
replace stateid = "BFO" if ifs==748
replace stateid = "POL" if ifs==964
replace stateid = "" if ifs==326
replace stateid = "" if ifs==887
replace stateid = "CHA" if ifs==628
replace stateid = "ALB" if ifs==914
replace stateid = "" if ifs==823
replace stateid = "LAO" if ifs==544
replace stateid = "" if ifs==815
replace stateid = "" if ifs==376
replace stateid = "ARG" if ifs==213
replace stateid = "MAW" if ifs==676
replace stateid = "" if ifs==373
replace stateid = "UZB" if ifs==927
replace stateid = "BAH" if ifs==419
replace stateid = "SLU" if ifs==362
replace stateid = "DJI" if ifs==611
replace stateid = "ETH" if ifs==644
replace stateid = "MZM" if ifs==688
replace stateid = "PAL" if ifs==565
replace stateid = "CUB" if ifs==928
replace stateid = "MOR" if ifs==686
replace stateid = "SUR" if ifs==366
replace stateid = "BUL" if ifs==918
replace stateid = "" if ifs==377
replace stateid = "SAL" if ifs==253
replace stateid = "CON" if ifs==634
replace stateid = "" if ifs==353
replace stateid = "COL" if ifs==233
replace stateid = "" if ifs==323
replace stateid = "BUI" if ifs==618
replace stateid = "HAI" if ifs==263
replace stateid = "MAA" if ifs==682
replace stateid = "" if ifs==349
replace stateid = "SKN" if ifs==361
replace stateid = "RUS" if ifs==922
replace stateid = "GAM" if ifs==648
replace stateid = "TRI" if ifs==369
replace stateid = "COM" if ifs==632
replace stateid = "" if ifs==318
replace stateid = "ZAM" if ifs==754
replace stateid = "DMA" if ifs==321
replace stateid = "" if ifs==839
replace stateid = "AAB" if ifs==311
replace stateid = "UAE" if ifs==466
replace stateid = "SOL" if ifs==813
replace stateid = "" if ifs==319
replace stateid = "" if ifs==568
replace stateid = "RUM" if ifs==968
replace stateid = "" if ifs==546
replace stateid = "SIN" if ifs==576
replace stateid = "" if ifs==459
replace stateid = "ANG" if ifs==614
replace stateid = "TUN" if ifs==744
replace stateid = "GUY" if ifs==336
replace stateid = "GUI" if ifs==656
replace stateid = "CHN" if ifs==924
replace stateid = "SYR" if ifs==463
replace stateid = "BOT" if ifs==616
replace stateid = "MAA" if ifs==681
replace stateid = "" if ifs==756
replace stateid = "SRI" if ifs==524
replace stateid = "YEM" if ifs==474
replace stateid = "BHU" if ifs==514
replace stateid = "BRU" if ifs==516
replace stateid = "BLZ" if ifs==339
replace stateid = "PAK" if ifs==564
replace stateid = "LEB" if ifs==446
replace stateid = "TAZ" if ifs==738
replace stateid = "TKM" if ifs==925
replace stateid = "DOM" if ifs==243
replace stateid = "" if ifs==856
replace stateid = "COS" if ifs==238
replace stateid = "BHM" if ifs==313
replace stateid = "THI" if ifs==578
replace stateid = "ISR" if ifs==436
replace stateid = "VAN" if ifs==846
replace stateid = "SER" if ifs==965
replace stateid = "SUD" if ifs==732
replace stateid = "GRN" if ifs==328
replace stateid = "MAS" if ifs==684
replace stateid = "GAB" if ifs==646
replace stateid = "SLV" if ifs==961
replace stateid = "" if ifs==333
replace stateid = "UKR" if ifs==926
replace stateid = "MSI" if ifs==867
replace stateid = "CAP" if ifs==624
replace stateid = "IND" if ifs==534
replace stateid = "MNG" if ifs==943
replace stateid = "BOL" if ifs==218
replace stateid = "CYP" if ifs==423
replace stateid = "" if ifs==532
replace stateid = "MYA" if ifs==518
replace stateid = "" if ifs==829
replace stateid = "" if ifs==832
replace stateid = "INS" if ifs==536
replace stateid = "NIC" if ifs==278
replace stateid = "ECU" if ifs==248
replace stateid = "HON" if ifs==268
replace stateid = "GNB" if ifs==654
replace stateid = "" if ifs==312
replace stateid = "TAW" if ifs==528
replace stateid = "MAL" if ifs==548
replace stateid = "" if ifs==329
replace stateid = "" if ifs==816
replace stateid = "QAT" if ifs==453
replace stateid = "JOR" if ifs==439
replace stateid = "ETM" if ifs==579
replace stateid = "EQG" if ifs==642
replace stateid = "UGA" if ifs==746
replace stateid = "SOM" if ifs==726
replace stateid = "LIT" if ifs==946
replace stateid = "SAF" if ifs==199
replace stateid = "FJI" if ifs==819
replace stateid = "PER" if ifs==293
replace stateid = "MLD" if ifs==921
replace stateid = "AZE" if ifs==912
replace stateid = "TUV" if ifs==869
replace stateid = "LIB" if ifs==672
replace stateid = "CAM" if ifs==522
replace stateid = "DRV" if ifs==582
replace stateid = "MAC" if ifs==962
replace stateid = "DRC" if ifs==636
replace stateid = "JAM" if ifs==343
replace stateid = "SVG" if ifs==364
replace stateid = "GRG" if ifs==915
replace stateid = "BAR" if ifs==316
replace stateid = "KEN" if ifs==664
replace stateid = "ARM" if ifs==911
replace stateid = "SEY" if ifs==718
replace stateid = "BNG" if ifs==513
replace stateid = "URU" if ifs==298
replace stateid = "ZIM" if ifs==698
replace stateid = "NAU" if ifs==836
replace stateid = "CRO" if ifs==960
replace stateid = "KYR" if ifs==917
replace stateid = "SIE" if ifs==724
replace stateid = "CDI" if ifs==662
replace stateid = "MON" if ifs==948
replace stateid = "" if ifs==473
replace stateid = "GHA" if ifs==652
replace stateid = "PNG" if ifs==853
replace stateid = "ERI" if ifs==643
replace stateid = "PHI" if ifs==566
replace stateid = "HUN" if ifs==944
replace stateid = "LES" if ifs==666
replace stateid = "FSM" if ifs==868
replace stateid = "CAO" if ifs==622
replace stateid = "CEN" if ifs==626
replace stateid = "BRA" if ifs==223
replace stateid = "" if ifs==363
replace stateid = "NEP" if ifs==558
replace stateid = "IRQ" if ifs==433
replace stateid = "LBR" if ifs==668
replace stateid = "LAT" if ifs==941
replace stateid = "EGY" if ifs==469
replace stateid = "" if ifs==351
replace stateid = "IRN" if ifs==429
replace stateid = "KBI" if ifs==826
replace stateid = "ALG" if ifs==612
replace stateid = "CHL" if ifs==228
replace stateid = "TOG" if ifs==742
replace stateid = "NAM" if ifs==728
replace stateid = "AFG" if ifs==512
replace stateid = "PAN" if ifs==283
replace stateid = "TUR" if ifs==186


sort stateid year

merge stateid year using "evrr_merge.dta"

sort stateid year


***Generate dummy variables beyond evrr_dejure + evrr_defacto***

gen dum_evrr_eldualcit = 0
replace dum_evrr_eldualcit= 1 if evrr_eldualcit==1

gen dum_evrr_eldualcit_permit = 0
replace dum_evrr_eldualcit_permit=1 if evrr_eldualcit_permit==1

gen dum_evrr_elsunset = 0
replace dum_evrr_eldualcit_permit=1 if evrr_eldualcit_permit==1

gen identification = 0
replace identification = 1 if evrr_elid==3
replace identification = 2 if evrr_elid==2
replace identification = 2 if evrr_elid==1
replace identification = 3 if evrr_elid==0
replace identification = . if evrr_elid==.e
replace identification = . if evrr_elid==.

gen dum_evrr_elregres = 0
replace dum_evrr_elregres=1 if evrr_elregres==1

gen dum_evrr_elregres_status = 0
replace dum_evrr_elregres_status=1 if evrr_elregres_status==1

gen dum_evrr_elregres_person = 0
replace dum_evrr_elregres_person=1 if evrr_elregres_person==1

gen dum_evrr_elreghome = 0
replace dum_evrr_elreghome=1 if evrr_elreghome==1

gen dum_evrr_elreghome_person = 0
replace dum_evrr_elreghome_person=1 if evrr_elreghome_person==1

gen dum_evrr_modiplo = 0
replace dum_evrr_modiplo=1 if evrr_modiplo==1

gen dum_evrr_modiplo_broad = 0
replace dum_evrr_modiplo_broad=1 if evrr_modiplo_broad==2

gen dum_evrr_moneighbor = 0
replace dum_evrr_moneighbor=1 if evrr_moneighbor==2

gen dum_evrr_moquotas = 0
replace dum_evrr_moquotas=1 if evrr_moquotas==2

gen dum_evrr_mopost = 0
replace dum_evrr_mopost=1 if evrr_mopost==2

gen dum_evrr_mopost_broad = 0
replace dum_evrr_mopost_broad=1 if evrr_mopost_broad==2

gen dum_evrr_moproxy = 0
replace dum_evrr_moproxy=1 if evrr_moproxy==2

gen dum_evrr_moonline = 0
replace dum_evrr_moonline=1 if evrr_moonline==2

gen dum_evrr_inexec = 0
replace dum_evrr_inexec=1 if evrr_inexec==1

gen dum_evrr_inleg = 0
replace dum_evrr_inleg=1 if evrr_inleg==1

gen dum_evrr_inleg_reps = 0
replace dum_evrr_inleg_reps=1 if evrr_inleg_reps==1

gen dum_evrr_inother = 0
replace dum_evrr_inother=1 if evrr_inother==1

gen dum_evrr_inquotas = 0
replace dum_evrr_inquotas=1 if evrr_inquotas==1


*Drop the observations that were not in the original Leblang

drop if obs_num==.

*Add labels


label variable DC  "Dual citizenship"
label variable expatshare  "(Expatriates/population) X 100"
label variable lnforeignstudent  "Log(foreign students)"
label variable lngdppercapita  "Log(GDP per capita)"
label variable lngdppc2  "Log(GDP per capita)2"
label variable lnexrate  "Exchange rate depreciation"
label variable lntotal  "Log(cost of natural disasters)"
label variable polity  "Democracy score"
label variable kaopen  "Capital account openness"
label variable lnpop  "Log(population)"


*Sort the data for testing

tsset, year

****Appendix Table 11****

*Model 1 - This Leblang Model is the baseline. Model 1 from Table 2. Page 88
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent   l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop, robust bw(2)

*Model 2 - Adding de jure
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure , robust bw(2)

*Model 3 - Adding de facto
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_defacto, robust bw(2)

*Model 4 - Adding Neighborhood polling stations + diaspora seats
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_moneighbor l.dum_evrr_inleg_reps, robust bw(2)



***Appendix Table 18 - Supplemental 1

*Model 1: Add evrr_dejure
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure , robust bw(2)

*Model 2: evrr_defacto
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_defacto, robust bw(2)

***For all other models, we add evrr_dejure + evrr_defacto

*Model 3: Add evrr_eldualcit
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_eldualcit, robust bw(2)

*Model 4: Add evrr_eldualcit_permit
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_eldualcit_permit, robust bw(2)




***Appendix Table 19 - Supplemental 2

*Model 5: Add evrr_elsunset
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_elsunset, robust bw(2)

*Model 6: Add evrr_elid 
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.identification, robust bw(2)

*Model 7: Add evrr_elregres
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto  l.dum_evrr_elregres, robust bw(2)

*Model 8: Add evrr_elregres_status
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_elregres_status, robust bw(2)



***Appendix Table 20 - Supplemental 3

*Model 9: Add evrr_elregres_person
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop  l.evrr_dejure l.evrr_defacto l.dum_evrr_elregres_person , robust bw(2)

*Model 10: Add evrr_elreghome
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_elreghome, robust bw(2)

*Model 11: Add evrr_elreghome_person
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_elreghome_person, robust bw(2)

*Model 12: Add evrr_modiplo
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_modiplo, robust bw(2)



***Appendix Table 21 - Supplemental 4

*Model 13: Add evrr_modiplo_broad
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_modiplo_broad, robust bw(2)

*Model 14: Add evrr_moneighbor
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_moneighbor, robust bw(2)

*Model 15: Add evrr_moquotas
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_moquotas, robust bw(2)

*Model 16: Add evrr_mopost
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_mopost, robust bw(2)



***Appendix Table 21 - Supplemental 5

*Model 17: Add evrr_mopost_broad
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_mopost_broad, robust bw(2)

*Model 18: Add evrr_moproxy
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_moproxy, robust bw(2)

*Model 19: Add evrr_moonline
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_moonline, robust bw(2)

*Model 20: Add evrr_inexec
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_inexec, robust bw(2)



***Appendix Table 21 - Supplemental 6

*Model 21: Add evrr_inleg
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_inleg, robust bw(2)

*Model 22: Add evrr_inleg_seats
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_inleg_reps, robust bw(2)

*Model 23: Add evrr_inother
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_inother, robust bw(2)

*Model 24: Add evrr_inquotas
ivreg2 lnremit l.DC l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop l.evrr_dejure l.evrr_defacto l.dum_evrr_inquotas, robust bw(2)



***Generate Figures***

*Here's the model from the Table we're using for the figure

ivreg2 lnremit l.DC l.evrr_dejure  l.evrr_defacto l.dum_evrr_moneighbor l.dum_evrr_inleg_reps l.expatshare l.lnforeignstudent l.lngdppercapita l.lngdppc2 ld.lnexrate l.lntotal l.polity l.kaopen l.lnpop, robust bw(2)

*Here's the model Leblang used figure according to his Fig2 do file:
**reg  lnremit DC expatshare lnforeignstudent lngdppercapita lngdppc2  lnexrate  lntotal polity kaopen lnpop , robust
*The equivalent for us is:

reg lnremit DC evrr_dejure evrr_defacto dum_evrr_moneighbor dum_evrr_inleg_reps expatshare lnforeignstudent lngdppercapita lngdppc2 lnexrate lntotal polity kaopen lnpop, robust

*Collapse the dataset to the country means, and then expand to generate 4 versions of each country

collapse lnremit DC evrr_dejure evrr_defacto dum_evrr_moneighbor dum_evrr_inleg_reps expatshare lnforeignstudent lngdppercapita lngdppc2 lnexrate lntotal polity kaopen lnpop year ifs, by(countryname)

expand 4
sort countryname
gen countryversion=mod(_n,4)

*Replace all the variables we're varying the predictors on, based on countryversion (values 0, 1, 2 and 3)

*First do countryversion 0 = No DC/No EV
replace DC=0 if countryversion==0
replace evrr_dejure=0 if countryversion==0
replace evrr_defacto=0 if countryversion==0
replace dum_evrr_moneighbor=0 if countryversion==0
replace dum_evrr_inleg_reps=0 if countryversion==0

*Dual Citizenship Only for countryversion 1
replace DC=1 if countryversion==1
replace evrr_dejure=0 if countryversion==1
replace evrr_defacto=0 if countryversion==1
replace dum_evrr_moneighbor=0 if countryversion==1
replace dum_evrr_inleg_reps=0 if countryversion==1

*No DC/EV+dum_evrr_moneighbor for countryversion 2
replace DC=0 if countryversion==2
replace evrr_dejure=1 if countryversion==2
replace evrr_defacto=1 if countryversion==2
replace dum_evrr_moneighbor=1 if countryversion==2
replace dum_evrr_inleg_reps=0 if countryversion==2

*No DC/EV+Diaspora Seats for countryversion 3
replace DC=0 if countryversion==3
replace evrr_dejure=1 if countryversion==3
replace evrr_defacto=1 if countryversion==3
replace dum_evrr_moneighbor=0 if countryversion==3
replace dum_evrr_inleg_reps=1 if countryversion==3

*Generate predicted values and upper & lower bounds for CI

predict y, xb
predict stdp, stdp
gen ub=y+1.96*stdp
gen lb=y-1.96*stdp
sort countryname

*Keep and label only the countries we want for the Figure

keep if ifs==273|ifs==566|ifs==686
encode countryname, gen(country)

gen country2=country-.3 + countryversion*.2

label define country2 1 "Mexico" 2 "Morocco" 3 "Philippines"
label val country2 country2

*Transform and scale (Billions of $) the logged variables for the Figure


gen ey=exp(y)
gen elb=exp(lb)
gen eub=exp(ub)
replace ey=ey/1000000000
replace elb=elb/1000000000
replace eub=eub/1000000000


gr twoway rcap elb eub country2 if countryversion==0, lcolor(black) horiz ||  rcap elb eub country2 if countryversion==1, lcolor(black) horiz ||  rcap elb eub country2 if countryversion==2, lcolor(black) horiz || rcap elb eub country2 if countryversion==3, lcolor(black) horiz || scatter country2 ey if countryversion==0, msymbol(circle) mcolor(black) || scatter country2 ey if countryversion==1, msymbol(diamond) mcolor(black) ||scatter country2 ey if countryversion==2, msymbol(triangle) mcolor(black) ylab(1 "Mexico" 2 "Morocco" 3 "Philippines") ytitle("") xtitle("Billions of USD") legend(order(5 "No DC/No EV" 6 "DC/No EV" 7 "No DC/EV + Additional Stations" 8 "No DC/EV + Diaspora Seats")) scheme(s2mono)|| scatter country2 ey if countryversion==3, msymbol(square) mcolor(black)
graph export "Fig7.png", replace width(1280)
